One or more aspects relate, in general, to processing within a computing environment, and in particular, to Boolean processing within the computing environment.
Many programming languages, which are used to create applications that perform functions within a computing environment, support Boolean expressions, such as expression=(a<b). However, hardware structures to implement Boolean expressions are inadequate. For instance, hardware supports condition registers, flags or predicates, but programming languages support byte, halfword, word or doubleword integer formats. Therefore, compilers are used to convert the result of comparisons, or sometimes more complex logical expressions contained in flags, condition fields or predicate fields, into integer words.
For instance, to convert an expression such as expression=(a<b) into an integer result, traditionally a sequence of instructions is used such as:
cmpw ra, rb(compare register a and register b)li r5, 0(load immediate register 5 with 0)bge next(branch on greater than or equal to Next)li r5, 1(load immediate register 5 with one)
Next:
Disadvantageously, this involves an expensive, hard to predict branch. Thus, one or more techniques have been used to address this problem. For example, automatic predication has been used which converts the conditional branch into a select instruction, as follows:
cmpw ra, rb(compare register a and register b)li r5, 0(load immediate register 5 with 0)li eR, 1(load immediate 1)isel<ge> R5, eR, r5(integer select on greater than or equal - selectbetween two registers based on condition incondition register)
Other prior embodiments may also use a conditional move instruction. These embodiments which use select and/or conditional move instructions use an inordinate number of (e.g., more than two) instructions and/or registers to provide an integer result.
Further, additional prior embodiments may use load conditional immediate instructions, such as:
cmp ra, rb(compare register a and register b)lhi r5, 0(load immediate 0 in register 5)lci r5, 1(load conditional immediate - if condition true, load1 in register 5)
However, this embodiment is unnecessarily expensive, by requiring the encoding of immediate numbers, and introducing dependencies between multiple instructions.
The deficiencies described above are further exacerbated when logical operations are to be performed on multiple condition results.